package com.team.employment.web.admin.controller.position;

import com.team.employment.common.result.Result;
import com.team.employment.model.entity.PositionInfo;
import com.team.employment.model.entity.ResumeInfo;
import com.team.employment.web.admin.dto.ResumeSearchDto;
import com.team.employment.web.admin.service.PositionInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "一级职位层级管理")
@RestController
@RequestMapping("/admin/position")
public class positionController {
    @Autowired
    private PositionInfoService positionInfoService;

    @Operation(summary = "查询所有一级职位列表")
    @GetMapping("getPosition")
    public Result<List<PositionInfo>> getPosition(){
        List<PositionInfo> list = positionInfoService.list();
        return Result.ok(list);
    }
    @Operation(summary = "保存或更新一级职位信息")
    @PostMapping("saveOrUpdate")
    public Result saveOrUpdate(@RequestBody PositionInfo positionInfo) {
        positionInfoService.saveOrUpdate(positionInfo);
        return Result.ok();
    }


    @Operation(summary = "级联逻辑删除一级职位")
    @DeleteMapping("/level1/{id}")
    public Result deleteLevel1(@PathVariable Long id) {
        //deleteCheck.DeleteCheckSuccessful(positionInfoService,id);
        positionInfoService.deleteLevel1(id);
        return Result.ok();
    }

}
